#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

int childProcess(int listenfd)
{
    sleep(1);
    printf("child %d\n", listenfd);
    return 0;
}

int main()
{
    pid_t pid;
    int   i      = 1;
    int   status = 0;
    pid          = fork();
    if(0 == pid) //子进程
    {
        childProcess(i);
        exit(0);
    }

    while(-1 != waitpid(-1, &status, WUNTRACED))
        ;
    exit(EXIT_SUCCESS);
}